//
//  DFStatuesCell.swift
//  新浪微博
//
//  Created by dafei on 16/5/26.
//  Copyright © 2016年 itheima. All rights reserved.
//

import UIKit

class DFStatuesCell: UITableViewCell {

    
    var statuesViewModel: DFStatuesViewModel? {
    
        didSet {
        
            //给原创模型赋值
            statuesOriginalView.statuesViewModel = statuesViewModel
        }
   
    }
    //进行初始化设置
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.backgroundColor = randomColor()
        setupUI()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //设置UI界面
    private func setupUI() {
    
        //自定义cell 添加视图不能直接使用cell加载 需要使用cell的contenView 添加子视图
        contentView.addSubview(statuesOriginalView)
        //设置约束
        statuesOriginalView.snp_makeConstraints { (make) in
            make.top.left.right.equalTo(self)
            make.height.equalTo(100)
        }
    
    
    }
 
    //懒加载子视图
    //原创weibo视图
    
    private lazy var statuesOriginalView: DFStatuesOriginalView = DFStatuesOriginalView()
    
    
    //用 xib加载会调用这个方法
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
